CONTENTS | INDEX | PREV | NEXT
 exit

 NAME
  exit - exit from a program 'nicely'

 SYNOPSIS
  (void) exit(code)

 FUNCTION
  exits the program and returns the specified exit code.  Normally you
  pass 0 to indicate no errors, a positive number to indicate a program
  error to the parent.

  exit() closes all stdio file pointers, low level file descriptors,
  perhaps other things, then finally calls _exit with the code.

  If you use main() you should call exit() to exit the program or
  return an error code from main.  If you use the _main() entry
  point (only for programmers dead set on optimizing executable
  size and using only system library calls) you should use the _exit()
  exit point.

 EXAMPLE
  main(ac, av)
  char *av[];
  {
      if (ac <= 1) {
      puts("I expected an argument you idiot!");
      exit(1);
      }
      puts("thanks for the argument!");
      exit(0);
  }

 SEE ALSO
  main, _main, _exit